// JavaScript Document
//esto es lo que agregue una nueva clase

Ajax.PassivePeriodicalUpdater = Class.create(Ajax.Base, {
initialize: function($super, container, url, options) {
$super(options);
this.onComplete = this.options.onComplete;

this.frequency = (this.options.frequency || 2);
this.decay = (this.options.decay || 1);

this.updater = { };
this.container = $(container);
this.url = url;

this.start();
},

start: function() {
this.options.onComplete = this.updateComplete.bind(this);
this.onTimerEvent();
},

stop: function() {
this.updater.options.onComplete = undefined;
clearTimeout(this.timer);
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
},

updateComplete: function(response) {
if (response.responseText == this.lastText) {
this.decay = this.decay * this.options.decay;
} else {
this.decay = 1;
this.container.update(response.responseText);
this.lastText = response.responseText;
}
this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
},

onTimerEvent: function() {
this.updater = new Ajax.Request(this.url, this.options);
}
});